<template>
	<view class="container">
		<view class="icon">
			<image src="../../../static/images/icon_success.png" v-if="!isFail"></image>
			<image src="../../../static/images/icon_fail.png" v-if="isFail"></image>
		</view>
		
		<view class="h1">{{isFail ? '激活失败' : '激活成功'}}</view>
		<view class="h2">{{mobile}}</view>
		<view class="p">{{notice}}</view>
		
		<button class="homeBtn fail" v-if="isFail" @click="onLickClick" >查看我的视频卡</button>
		<view class="bottom"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isFail: false,
				from: null,
				mobile: '',
				notice: ''
			};
		},
		
		computed: {
			shareAppMessage () {
				return this.$store.state.shareAppMessage
			},
			
			userInfo () {
				return this.$store.state.userInfo
			}
		},
		
		onLoad(params) {
			this.from = params.from || null
			
			let res = JSON.parse(params.res);
			
			if (params.status == 1) {
				this.mobile = res.data == null ? '' : res.data.chargeInfo ? res.data.chargeInfo : ''
				this.notice = "视频卡激活成功，请到相应的视频网站或APP使用本手机号登录即可观看VIP视频了哦"
			} else {
				this.isFail = true
				this.mobile = res.data == null ? '' : res.data.chargeInfo ? res.data.chargeInfo : ''
				this.notice = res.msg
			}
		},
		
		methods: {
			onLickClick () {
				if(this.from == 'list'){
					this.onBackClick()
				}else{
					uni.redirectTo({
						url: '/pages/video-card/list/list'
					})
				}
			},
			
			onBackClick () {
				uni.navigateBack({
					
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.container{
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
		justify-content: center;
		padding: 0;
	}

	.icon{
		width: 240px;
		height: 240px;
		padding-top: 40px;
		
		image{
			width: 100%;
			height: 100%;
		}
	}

	.h1{
		font-size: 40px;
		color: #333;
		margin-top: 60px;
	}

	.h2{
		font-size: 32px;
		color: #333;
		margin-top: 60px;
	}

	.p{
		font-size: 24px;
		color: #666;
		margin-top: 60px;
		padding: 0 120px;
	}

	.homeBtn{
		width: 40%;
		padding: 0;
		line-height: 100px;
		background: #fff;
		border: 1px solid #eb0000;
		color: #eb0000;
		border-radius: 50px;
		font-size: 28px;
		margin-top: 120px;
		box-sizing: border-box;
		
		&.fail{
			color: #333;
			border: 1px solid #333;
		}
	}
</style>
